package inits

import (
	"doctor-srv/basic/config"
	"log"

	"github.com/spf13/viper"
)

func init() {
	viper.SetConfigName("dev")
	viper.SetConfigType("yaml")
	viper.AddConfigPath(".")
	viper.AddConfigPath("../../../")

	if err := viper.ReadInConfig(); err != nil {
		log.Fatalf("Error reading config file: %v", err)
	}

	config.Conf = &config.Config{}
	if err := viper.Unmarshal(config.Conf); err != nil {
		log.Fatalf("Error unmarshaling config: %v", err)
	}

	log.Println("Config loaded successfully")
}

